package com.jzbooks.enums;

/**
 * @author mingPeng
 * @date 2021/4/18 16:43
 * @Description : 错误码包装枚举类
 */
public enum ResultCodeEnum {
    /*状态码*/
    SUCCESS(1,"SUCCESS"),
    Fail(-1,"FAIL"),
    /*状态码*/
    STATUS_CODE_400(400,"请求无效"),
    STATUS_CODE_403(403,"禁止访问"),
    STATUS_CODE_404(404,"请求的API不存在"),
    STATUS_CODE_405(405,"资源被禁止"),
    STATUS_CODE_500(500,"内部服务器错误,请联系管理员"),
    STATUS_CODE_503(503,"服务器繁忙，请稍后重试"),


    /* 用户错误：20001-29999*/
    USER_NOT_LOGGED_IN(20001, "用户未登录"),
    USER_LOGIN_ERROR(20002, "账号不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"),
    USER_NOT_EXIST(20004, "用户不存在"),
    USER_HAS_EXISTED(20005, "用户已存在"),
    USER_CHANGE_PWD_ERROR(20006, "修改密码失败，请检查数据是否正确"),
    USER_LOGIN_FAIL(20007, "登录失败"),
    USER_HAS_NOT_PERMISSION(20008, "权限不足"),

    /* 系统错误：40001-49999 */
    SYSTEM_INNER_ERROR(40001, "系统繁忙，请稍后重试"),

    /* 权限错误：70001-79999 */
    PERMISSION_NO_ACCESS(70001, "无访问权限"),
    ILLEGAL_TOKEN(70008, "非法的令牌"),
    OTHER_CLIENTS_LOGGED_IN(70012, "其他客户端登陆"),
    TOKEN_EXPIRED(70014, "令牌过期"),

    ;


    private Integer code;
    private String msg;
    ResultCodeEnum(Integer code, String msg) {
        this.msg = msg;
        this.code = code;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    @Override
    public String toString() {
        return "ResultCodeEnum{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                '}';
    }
}
